package shaka.ui

import shaka.db.DbEngine
import shaka.groovy.db.DbGryTools

class SqliteTest {
	public static void main(String[] args) {
		//		tableReady()
		//		DbGryTools.withTransaction {
		//			DbEngine db = DbEngine.instance
		//			Class[] type = [int, String, Timestamp] as Class[]
		//
		//			Timestamp now = new Timestamp(System.currentTimeMillis())
		//			db.pSql("INSERT INTO TEST1 VALUES (?, ?, ?)")
		//			db.pUpdate(type, [1, "這是一個測試的喔", now] as Object[])
		//			db.pUpdate(type, [2, "櫻花", now] as Object[])
		//			db.pUpdate(type, [3, "樱花", now] as Object[])
		//			db.pUpdate(type, [4, "桜花", null] as Object[])
		//		}
		//		DbGryTools.withNoTransaction {
		//			DbEngine db = DbEngine.instance
		//			db.pSql("select fn_name, value from func_storage where fn_name = ?")
		//			for(Map row : db.pQuery([String] as Class[], ['SwtMklinkPanel'] as Object[])){
		//				println row
		//			}
		//		}
		List list = []
		for(Map row : FuncStorage.instance.funcs('SwtMklinkPanel')){
			list << row['key']
		}
		println list
		println 'OK!!'
	}

	//	static void tableReady(){
	//		DbGryTools.withTransaction {
	//			DbEngine db = DbEngine.instance
	//			db.update("""
	//			create table if not exists test1 (
	//				id integer primary key,
	//				name varchar(30)
	//			)
	//			""")
	//		}
	//	}
}
